package com.zhuyp.spring.boot.utils;

/**
 * API结果
 */
public class APIResult {

	/**
	 * 返回代码的key值
	 */
	public static final String ERROR_CODE = "returnCode";
	/**
	 * 返回说明的key值
	 */
	public static final String ERROR_MSG = "returnMsg";

	/**
	 * 返回成功的代码值
	 */
	public static final int ERROR_CODE_OK = 0;
	/**
	 * 返回成功的说明值
	 */
	public static final String ERROR_MSG_OK = "success";

	public static final int ERROR_CODE_UNLOGIN = 400;

	public static final String ERROR_MSG_UNLOGIN = "unlogin";

	/**
	 * fail
	 */
	public static final int ERROR_CODE_FAIL = 100;
	/**
	 * DATA Exception Code
	 */
	public static final int DATA_EXCEPTION_CODE = 110;
	/**
	 * DATA Exception
	 */
	public static final String DATA_EXCEPTION_MSG = "DATA EXCEPTION";
	/**
	 * 450 缺少参数
	 */
	public static final int ERROR_CODE_LACK_OF_PARAMETEER = 450;
	/**
	 *缺少参数
	 */
	public static final String ERROR_MSG_LACK_OF_PARAMETEER = "Lack of parameter";

	/**
	 * fail
	 */
	public static final String ERROR_MSG_FAIL = "fail";

	/**
	 * 未知的错误代码
	 */
	public static final int ERROR_CODE_UNKNOW = 2000;
	/**
	 * 未知的错误
	 */
	public static final String ERROR_MSG_UNKNOW = "unknow error";

	/**
	 * 已经存在的用户名代码
	 */
	public static final int ERROR_CODE_EXIST_USERNAME = 2001;
	/**
	 * 已经存在的用户名
	 */
	public static final String ERROR_MSG_EXIST_USERNAME = "exist username";
	/**
	 * 没有该订单
	 */
	public static final String ERROR_MSG_NOTORDER = "NOT ORDER";
	
	/**
	 * 返回码-取消收藏
	 */
	public static final int ERROR_CODE_CANCEL_FAVORITE_OK = 444;

	/**
	 * 返回代码的key值
	 */
	private int returnCode;
	/**
	 * 返回说明的key值
	 */
	private String returnMsg;

	/**
	 * @param msg
	 * @param code
	 * 
	 */
	public APIResult(int code, String msg) {
		this.returnCode = code;
		this.returnMsg = msg;
	}

	public APIResult() {
		this.returnCode = ERROR_CODE_OK;
		this.returnMsg = ERROR_MSG_OK;
	}

	public int getReturnCode() {
		return returnCode;
	}

	public void setReturnCode(int returnCode) {
		this.returnCode = returnCode;
	}

	public String getReturnMsg() {
		return returnMsg;
	}

	public void setReturnMsg(String returnMsg) {
		this.returnMsg = returnMsg;
	}

}
